<table class="table table-bordered">
    <thead>
    <tr>
        <th style="width:100px">编号</th>
        <th>客户名称</th>
        <th style="width:140px">联系人邮箱</th>
        <th style="width:140px">联系人邮箱2</th>
        <th style="width:100px">当前跟进人</th>
        <th style="width:80px">客户星级</th>
        <th style="width:80px">订单属性</th>
        <th style="width:100px">联系电话</th>
        <th>客户来源</th>
        <th style="width:50px">国家</th>
        <th style="width:50px">客户备注</th>
        <th>Skype</th>
        <th>Whatsapp</th>
        <th>wechat</th>
        <th style="width:100px">操作</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <?php foreach ($this->params['list'] as $v): ?>
        <?php $data = json_decode($v['sql'], true); ?>
        <td><?php echo $data['number']; ?></td>
        <td><?php echo $data['customer_name']; ?></td>
        <td><?php echo $data['email']; ?></td>
        <td><?php echo $data['email2']; ?></td>

        <td>
            <?php foreach ($this->params['staff'] as $v2): ?>
                <?php if ($v2['job_number'] == $data['follow_man']): ?>
                    <?php echo $v2['name']; ?>
                <?php endif; ?>
            <?php endforeach; ?>
        </td>
        <td>
            <?php echo $data['customer_star']; ?>星
        </td>

        <td>
            <?php if ($data['property'] == 1) {
                echo '未下单';
            } elseif ($data['property'] == 2) {
                echo '样品单';
            } elseif ($data['property'] == 3) {
                echo '已下单';
            }; ?>
        </td>
        <td><?php echo $data["phone"]; ?></td>
        <td>
            <?php foreach ($this->params['customerRefer'] as $v2): ?>
                <?php if ($v2['id'] == $data['refer']): ?>
                    <?php echo $v2['name']; ?>
                <?php endif; ?>
            <?php endforeach; ?>
        </td>
        <td><?php echo $data["country"]; ?></td>
        <td><?php echo $data['customer_remark']; ?></td>
        <td><?php echo $data['skype']; ?></td>
        <td><?php echo $data['whatsapp']; ?></td>
        <td><?php echo $data['wechat']; ?></td>
        <td>
            <button class="btn btn-success" onclick="update(<?php echo $v['id']; ?>)">更新</button>
        </td>
    </tr>
    <?php endforeach; ?>
    </tbody>
</table>
<script>
    function update(id) {
        layer.confirm('确认按此条记录更新', {}, function () {
            $.post('/api/customer-update-act', {id: id}, function (res) {
                if (res.code==1) {
                    layer.alert(res.msg);
                    setTimeout(function(){
                        window.location.reload();
                    },1000)
                }else {
                    layer.alert(res.msg);
                }
            },'json');
        })
    }
</script>